//router.js
import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';

//3.定义路由- 配置路由走向
const routes = [
    //重定向
    {
        path:'/',
        redirect:'/home'
    },
    {
        path: "/login", //页面的路径
        component: () => import('@/views/accounts/Login.vue')  //去哪个页面
    },
    {
        path:"/register",
        component: () => import('@/views/accounts/Register.vue')
    },
    {
        path:"/home",
        component: () => import('@/views/page/Home.vue'),
        children:[
            {
                path:"pit",
                component: () => import('@/views/page/main/Pit.vue'),
                meta:{
                    title:"全局驾驶舱"
                }
            },
            {
                path:"device",
                component: () => import('@/views/page/main/DeviceInfo.vue'),
                meta:{
                    title:"设备管理详情"
                }
            },
            {
                path:"user",
                component: () => import('@/views/page/main/Person.vue'),
                meta:{
                    title:"人员管理"
                }
            },
            {
                path:"environment",
                component: () => import('@/views/page/main/Environment.vue'),
                meta:{
                    title:"环境管理"
                }
            },
        ]
    },
    {
        path:"/tempMonitor",
        component:()=> import('@/views/monitor/THMonitor.vue'),
    }


];

//4. 创建router实例，然后传“routes”配置
const router = createRouter({
    history: createWebHistory(),
    routes
});

//7.导出router
export default router;
